package com.loe.test

import android.app.AlertDialog
import android.app.Dialog
import android.os.Bundle
import androidx.fragment.app.DialogFragment
import com.loe.mvp.BaseActivity
import com.loe.mvp.ext_java.delay
import com.loe.mvp.ext_view.setDelayClickListener
import com.loe.test.dialog.DoubleDialog
import kotlinx.android.synthetic.main.activity_main2.*

class MainActivity2 : BaseActivity()
{
    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main2)

        class SimpleDialogFragment : DialogFragment()
        {
            override fun onCreateDialog(savedInstanceState: Bundle?): Dialog
            {
                return AlertDialog.Builder(activity)
                    .setTitle("提示")
                    .setMessage("这是一个 DialogFragment")
                    .setPositiveButton("确定", null)
                    .create()
            }
        }


        buttonLoad.setDelayClickListener()
        {
//            DoubleDialog(this)
//                .msg("就觉得黑科技东方航空代发几哈更大饭卡很大发卡机很大饭卡个快进到付过款到付件")
//                .show()
//                {
//                }
            SimpleDialogFragment().show(supportFragmentManager, "tag")
            delay(1000)
            {
                SimpleDialogFragment().show(supportFragmentManager, "tag")
            }

//            val path = HttpFileUtil.downPath + "test.json"
//            val path = filesDir.toString() + "/" + "test.json"
//            LoeHttp.getFile("http://192.168.191.1:8080/test/plugin/config.json")
//                .save(path)
//                .okString()
//                {
//                    val file = File(it)
//                    toast(if(file.exists()) "下载成功" + path else "下载失败")
//                    Log.d("runtime", path)
//                }
        }

//        buttonLoad.performClick()
    }
}